package com.definesys.smecrailtransit.api;

import com.definesys.smecrailtransit.SmecManager.SmecRetrofit.HttpResult;
import com.definesys.smecrailtransit.module.Login.bean.CheckUpdateBean;
import com.definesys.smecrailtransit.module.Login.bean.SmecUser;
import com.definesys.smecrailtransit.module.MonthForm.bean.CarePlanBean;
import com.definesys.smecrailtransit.module.MonthForm.bean.FaultLogBean;
import com.definesys.smecrailtransit.module.MonthForm.bean.MonthFormBean;
import com.definesys.smecrailtransit.module.MonthForm.bean.PositionBean;
import com.definesys.smecrailtransit.module.RealStatus.bean.ELeRealNumBean;
import com.definesys.smecrailtransit.module.RealTime.bean.RealTimeBean;
import com.definesys.smecrailtransit.module.SiteDetails.bean.ELeStatusBean;
import com.definesys.smecrailtransit.module.SiteDetails.bean.EleAttentionBean;
import com.definesys.smecrailtransit.module.SiteDetails.bean.EleErrorContentBean;
import com.definesys.smecrailtransit.module.SiteDetails.bean.EleFaultStationsBean;
import com.definesys.smecrailtransit.module.SiteDetails.bean.EleLineBean;
import com.definesys.smecrailtransit.module.SiteDetails.bean.EleStationRunTimeBean;
import com.definesys.smecrailtransit.module.TotalTime.bean.DateTimeBean;
import com.definesys.smecrailtransit.module.TotalTime.bean.ElevatorBean;
import com.definesys.smecrailtransit.module.TotalTime.bean.TotalTimeBean;
import com.definesys.smecrailtransit.service.LogService.ExceptionDto;

import java.util.ArrayList;
import java.util.HashMap;

import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.CARE_PLAN;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.CHECK_UPDATE;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.ELEVATOR_TIME;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.EXCEPTION_MSG_UPLOAD;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.FAULT_LOG;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_ALL_STATIONS;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_ATTENTION;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_ELE_ERROR_CONTENT;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_ELE_ERROR_REPORT;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_REAL_ELE_NUM;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_SITE_ELE_ERROE;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_SITE_RUN_TIME;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.GET_STATION_ELE_STATUS;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.LINE_TIME;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.MONTH_REPORT;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.MAKE_SURE_JPUSH;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.REAL_TIME;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.STATION_REPORT;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.STATION_TIME;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.UPDATE_ATTENTION;
import static com.definesys.smecrailtransit.api.SmecRailApi.SmecConstant.USER_LOGIN;

/**
 * Created by xupeizuo on 2017/7/20.
 */

public interface SmecRailService {


    /**
     * 上传异常信息
     * @param
     * @return
     */
    @POST(EXCEPTION_MSG_UPLOAD)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<Object>> sendExceptionMsgToServer(@Body ExceptionDto exceptionDto);

    /**
     * 用户登录
     * @param userName
     * @param password
     * @return
     */
    @GET(USER_LOGIN)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<SmecUser>> login(@Query("username") String userName , @Query("password") String password);

    /**
     * 检查版本更新
     * @param map
     * @return
     */
    @POST(CHECK_UPDATE)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<CheckUpdateBean>> checkUpdate(@Body HashMap<String,String> map);


    /**
     * 实时故障列表
     * @param map
     * @return
     */
    @POST(REAL_TIME)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<RealTimeBean>>> realTime(@Body HashMap<String,String> map);

    /**
     * 线路月报表查看
     * @param map
     * @return
     */
    @POST(MONTH_REPORT)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<MonthFormBean>> monthForm(@Body HashMap<String,String> map);

    /**
     * 站点报表查看
     * @param map
     * @return
     */
    @POST(STATION_REPORT)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<PositionBean>>> stationForm(@Body HashMap<String,Object> map);

    /**
     * 故障日志查看
     * @param map
     * @return
     */
    @POST(FAULT_LOG)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<FaultLogBean>> faultLog(@Body HashMap<String,Object> map);

    /**
     * 保养计划查看
     * @param map
     * @return
     */
    @POST(CARE_PLAN)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<CarePlanBean>>> carePlan(@Body HashMap<String,Object> map);

    /**
     * 线路运行时长
     * @param map
     * @return
     */
    @POST(LINE_TIME)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<TotalTimeBean>> lineTime(@Body HashMap<String,Object> map);

    /**
     * 站点运行时长
     * @param map
     * @return
     */
    @POST(STATION_TIME)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<ElevatorBean>>> stationTime(@Body HashMap<String,Object> map);

    /**
     * 电梯运行时长
     * @param map
     * @return
     */
    @POST(ELEVATOR_TIME)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<DateTimeBean>>> elevatorTime(@Body HashMap<String,Object> map);

    /**
     *  确认收到推送接口
     * @param map
     * @return
     */
    @POST(MAKE_SURE_JPUSH)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult> makeSureJpush(@Body HashMap<String,String> map);


    /**
     *  获取站点电梯实时状态
     * @param map
     * @return
     */
    @POST(GET_STATION_ELE_STATUS)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<ELeStatusBean>>> getRealTimeEleStatus(@Body HashMap<String,Integer> map);


    /**
     *  获取电梯故障内容
     * @param map
     * @return
     */
    @POST(GET_ELE_ERROR_CONTENT)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<EleErrorContentBean>> getEleErrorContent(@Body HashMap<String,Object> map);

    /**
     *  获取站点详情故障统计
     * @param map
     * @return
     */
    @POST(GET_ELE_ERROR_REPORT)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<EleFaultStationsBean>> getSiteEleError(@Body HashMap<String,String> map);


    /**
     *  获取站点电梯运行时长
     * @param map
     * @return
     */
    @POST(GET_SITE_RUN_TIME)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<EleStationRunTimeBean>>> getSiteRunTime(@Body HashMap<String,Object> map);


    /**
     *  获取制定站点电梯故障统计
     * @param map
     * @return
     */
    @POST(GET_SITE_ELE_ERROE)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<EleFaultStationsBean>> getSiteEleFault(@Body HashMap<String,Object> map);

    /**
     *  获取指定线路电梯台数
     * @param map
     * @return
     */
    @POST(GET_REAL_ELE_NUM)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ELeRealNumBean>> getRealEleNum(@Body HashMap<String,String> map);

    /**
     *  获取用户关注站点
     * @param map
     * @return
     */
    @POST(GET_ATTENTION)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<EleAttentionBean>> getAttention(@Body HashMap<String,Object> map);


    /**
     *  修改用户关注的站点
     * @param map
     * @return
     */
    @POST(UPDATE_ATTENTION)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult> updateAttention(@Body HashMap<String,Object> map);


    /**
     *  获取所有线路站点信息
     * @param map
     * @return
     */
    @POST(GET_ALL_STATIONS)
    @Headers({"Accept: application/vnd.githuSampleb.v3.full+json"})
    Observable<HttpResult<ArrayList<EleLineBean>>> getAllStations(@Body HashMap<String,Object> map);
}
